# Maintainer: Maksim Bondarenkov <maksapple2306@gmail.com>

_commonname=ttf-nerd-fonts-symbols
pkgbase=mingw-w64-${_commonname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_commonname}"
         "${MINGW_PACKAGE_PREFIX}-${_commonname}-mono"
         "${MINGW_PACKAGE_PREFIX}-${_commonname}-common")
pkgver=3.2.1
pkgrel=1
pkgdesc="High number of extra glyphs from popular 'iconic fonts' (mingw-w64)"
arch=('any')
mingw_arch=('ucrt64' 'clang64' 'clangarm64')
url='https://www.nerdfonts.com'
msys2_repository_url='https://github.com/ryanoasis/nerd-fonts'
msys2_references=(
  'archlinux: ttf-nerd-fonts-symbols'
)
license=('spdx:MIT')
source=(
  "SymbolsNerdFont-Regular-${pkgver}.ttf::https://raw.githubusercontent.com/ryanoasis/nerd-fonts/v${pkgver}/patched-fonts/NerdFontsSymbolsOnly/SymbolsNerdFont-Regular.ttf"
  "SymbolsNerdFontMono-Regular-${pkgver}.ttf::https://raw.githubusercontent.com/ryanoasis/nerd-fonts/v${pkgver}/patched-fonts/NerdFontsSymbolsOnly/SymbolsNerdFontMono-Regular.ttf"
  "10-nerd-font-symbols-${pkgver}.conf::https://raw.githubusercontent.com/ryanoasis/nerd-fonts/v${pkgver}/10-nerd-font-symbols.conf"
  "Nerd_Fonts-${pkgver}-LICENSE::https://raw.githubusercontent.com/ryanoasis/nerd-fonts/v${pkgver}/LICENSE"
)
sha256sums=('4bc091384cbc8d12b333fb1fcecce8b4701149dbce1f1271ab74374abb7ba906'
            '6f7e339af33bde250a4d7360a3176ab1ffe4e99c00eef0d71b4c322364c595f3'
            '6601e431c5c43d80dfce375147b297df0b36bb4d465948f8f2178c1da89ace76'
            '1f6ad4edae6479aaace3112ede5279a23284ae54b2a34db66357aef5f64df160')

package_ttf-nerd-fonts-symbols() {
  groups=("${MINGW_PACKAGE_PREFIX}-nerd-fonts")
  depends=("${MINGW_PACKAGE_PREFIX}-${_commonname}-common")
  provides=("${MINGW_PACKAGE_PREFIX}-ttf-font-nerd")

  install -Dm644 "Nerd_Fonts-${pkgver}-LICENSE" \
    "${pkgdir}${MINGW_PREFIX}/share/licenses/${_commonname}/LICENSE"

  install -Dm644 "SymbolsNerdFont-Regular-${pkgver}.ttf" \
    "${pkgdir}${MINGW_PREFIX}/share/fonts/TTF/SymbolsNerdFont-Regular.ttf"
}

package_ttf-nerd-fonts-symbols-mono() {
  groups=("${MINGW_PACKAGE_PREFIX}-nerd-fonts")
  depends=("${MINGW_PACKAGE_PREFIX}-${_commonname}-common")
  provides=("${MINGW_PACKAGE_PREFIX}-ttf-font-nerd")
  pkgdesc+=" (Monospace)"

  install -Dm644 "Nerd_Fonts-${pkgver}-LICENSE" \
    "${pkgdir}${MINGW_PREFIX}/share/licenses/${_commonname}-mono/LICENSE"

  install -Dm644 "SymbolsNerdFontMono-Regular-${pkgver}.ttf" \
    "${pkgdir}${MINGW_PREFIX}/share/fonts/TTF/SymbolsNerdFontMono-Regular.ttf"
}

package_ttf-nerd-fonts-symbols-common() {
  pkgdesc+=" (Common files)"
  install -Dm644 "10-nerd-font-symbols-${pkgver}.conf" \
    "${pkgdir}${MINGW_PREFIX}/etc/fonts/conf.avail/10-nerd-font-symbols.conf"
}

# template start; name=mingw-w64-splitpkg-wrappers; version=1.0;
# vim: set ft=bash :

# generate wrappers
for _name in "${pkgname[@]}"; do
  _short="package_${_name#${MINGW_PACKAGE_PREFIX}-}"
  _func="$(declare -f "${_short}")"
  eval "${_func/#${_short}/package_${_name}}"
done
# template end;
